package ink.zhaohui.javaStudy;

import ink.zhaohui.javaStudy.annotation.*;

public class Car {

    @Monitor(see={Monitor.Type.SPEED,Monitor.Type.PARAMS})
    public void run(int m) {
        try {
            System.out.println("before sleep.");
            java.lang.Thread.sleep(1000 * m);
            System.out.println("after  sleep.");
            throw new Exception("e");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    @Monitor(see={Monitor.Type.SPEED,Monitor.Type.PARAMS})
    public void run(int m,String word) {
        try {
            System.out.println("before sleep.");
            java.lang.Thread.sleep(1000 * m);
            System.out.println("["+m+"]["+word+"]");

            prun(m, word);

            System.out.println("after  sleep.");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Monitor(see={Monitor.Type.SPEED,Monitor.Type.PARAMS})
    private void prun(int m,String word) {
        try {
            System.out.println("before sleep p.");
            java.lang.Thread.sleep(1000 * m);
            System.out.println("["+m+"]["+word+"]");
            System.out.println("after  sleep p.");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}